<template>
	<div class="zixun">
		<div v-for="(item,index) in list">
			<div class="cell_list" @click="xiangqing(item)">
				<div class="list_left">
					<p>{{item.newsTitle}}</p>
					<span class="list_time">{{item.createTime}}</span>
				</div>
				<div class="list_right" v-if="item.headImgUrl">
					<img :src="item.headImgUrl" alt="">
				</div>
			</div>
		</div>
		<!-- <van-list
		      v-model="loading"
		      :finished="finished"
		      :immediate-check="false"
		      finished-text="没有更多了"
		      @load="onLoad"
		      :offset="10"
		    >
		      <van-cell v-for="item in itemList" :key="item.id">
		       <div class="cell_list" @click="xiangqing(item)">
						 <div class="list_left">
							 <p>分布合理价位日军公司如果微软官网虽然</p>
							 <span class="list_time">2021/02/26</span>
						 </div>
						 <div class="list_right">
							<img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fa0.att.hudong.com%2F30%2F29%2F01300000201438121627296084016.jpg&refer=http%3A%2F%2Fa0.att.hudong.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616652551&t=901a5393519edaf176a2790655ef4825" alt="">
						 </div>
					 </div>
		      </van-cell>
		    </van-list> -->
	</div>
</template>

<script>
	export default {
		data() {
			return {
				loading: false,
				finished: false,
				page: 1, //请求第几页
				pageSize: 10, //每页请求的数量
				total: 0, //总共的数据条数
				itemList: 20,
				list: []
			};
		},
		created() {
			//创建组件时，加载第1页数据
			this.getroadList();
			this.qiulist()
		},
		methods: {
			getroadList() {
				let params = {
					page: this.page,
					pageSize: this.pageSize
				};
				console.log(this.page)
				this.loading = false;
			},
			qiulist() {
				this.$axios.post('http://a.chuxingcai.com/prod-api/webapi/news/query', {
					"classId": 1,
					"title": ''
				}, {
					headers: {
						token: window.sessionStorage.getItem('token')
					}
				}).then((res) => {
					console.log(res.data.data.rows)
					this.list=res.data.data.rows
				})
			},
			//滚动加载时触发，list组件定义的方法
			onLoad() {
				this.page++;
				this.itemList = this.itemList + 10
				this.getroadList();
			},
			xiangqing(item) {
				console.log(item)
				this.$router.push({path:'/news',query:item})
			}
		}
	};
</script>

<style scoped>
	* {
		padding: 0;
		margin: 0;
	}

	.zixun {
		padding-top: 1px;
		background-color: white;
	}

	.van-cell {
		width: 100%;
		height: 85px;
		padding: 0;
		margin-top: 10px;
		overflow: visible;
	}

	.cell_list {
		width: 95%;
		border-bottom: 1px solid #E1E1E1;
		height: 85px;
		margin: 0 auto;
		display: flex;
		overflow: hidden;
	}

	.van-cell__value {
		overflow: visible;
	}

	.list_left {
		flex: 2;
		height: 80px;
		margin-top: 5px;
		margin-left: 10px;
		position: relative;
		/* border: 1px solid red; */
	}

	.list_left>p {
		font-size: 15px;
		font-weight: 600;
	}

	.list_right {
		flex: 1;
		margin-top: 5px;
		height: 76px;
		margin-left: 25px;
	}

	.list_right>img {
		width: 100%;
		height: 100%;
		border-radius: 5px;
	}

	.list_time {
		position: absolute;
		font-size: 13px;
		bottom: 0;
		color: #93999F;
	}
</style>
